import app
import requests


class HomeApi:
    def __init__(self):
        # 轮播图
        self.banner_url = app.host_url + "banner/{}"
        # 专题栏
        self.theme_url = app.host_url + "theme"
        # 最近新品
        self.product_url = app.host_url + "product/recent"

    def bannerApi(self, id=1):
        return requests.get(self.banner_url.format(id))

    def themeApi(self, ids="1,2,3"):
        data = {"ids": ids}
        return requests.get(self.theme_url, params=data)

    def productApi(self):
        return requests.get(self.product_url)
